// pages/driver/wallet/wallet.js
const handler = require("../../../utils/function.js");
const app = getApp();
var api = require("../../../api.js");
Page({
    /**
     * 页面的初始数据
     */
    data: {
        img: handler.driverImg,
        TodayIncome: 0, //今日收入
        Spending: 0, //总支出
        Income: 0, //总收入
        Refund: 0, //退款
        balance: 0, //余额
        list: {},
    },
    intoPageHandler: function(e) {
        
        handler.intoPageHandler(e.currentTarget.dataset.skip);
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function(options) {
        console.log('提现',options)
    },
    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function() {},
    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function() {
        var that = this;
        app.request({
            url: api.wallet.wallet,
            method: 'post',
            data: {},
            success: function(rs) {
                console.log(rs)
                if (rs.code == 1) {
                    that.setData({
                        TodayIncome: rs.data.user.TodayIncome, //今日收入
                        TodayIncome: rs.data.user.TodayIncome, //今日收入
                        Spending: rs.data.conclusion.Spending, //总支出
                        Income: rs.data.conclusion.Income, //总收入
                        Refund: rs.data.conclusion.Refund, //退款
                        balance: rs.data.user.price, //余额
                        list: rs.data.wallet.data,
                    });
                }
            }
        })
    },
    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function() {},
    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function() {},
    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function() {},
    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function() {},
    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function() {}
})